package com.waves.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;

/**
 * @Package: com.waves.demo.controller
 * @Author: Mr.Waves
 * @Date: 2020-04-03 10:25
 * @Description:
 **/
@Controller
@RequestMapping("view")
public class ViewController {

    @GetMapping("index")
    public String index(HttpServletRequest request) {

        /*
         * 配置全局变量
         */
        request.setAttribute("globalVar","全局变量: 本模块通用");
        request.setAttribute("title","首页");
        request.setAttribute("dateList", Arrays.asList(new Date(),new Date(),new Date()));  // beetl内置日期格式化函数只针对java.util.Date类型的日期变量
        return "index.html";
    }
}
